#ifndef CMETAMESH_H
#define CMETAMESH_H

#include <QVector>
#include <vector>

#include "cvertex.h"
#include "cedge.h"
#include "cface.h"
#include "cmesh.h"
#include "cintersectionpoint.h"

class CMetaMesh
{
public:
	CMetaMesh(CMesh * pM1, CMesh * pM2);

	void					merge();

	void					buildMorphMesh();

	CMesh *					getMorphMesh();

protected:
	void					clearAllVectors();

	bool					isVertexInFace (CVertex* pV, CFace * pF);
	bool					doArcsIntersect(CEdge * pE1, CEdge * pE2);
	bool					isPointOnArc(CPoint3f * pP, CPoint3f * pDebArc, CPoint3f * pFinArc);
	void					computeSphericAngles (CPoint3f * pP, double & theta, double & phi);

	CEdge *					findEdgeOfFace(CFace * pF);
        QVector <CEdge*>                        getEdgesOfFace(CFace * pF);

	unsigned				getIndOfEdge(CEdge * pEdge);

	void					addEdgeToVect(CEdge * pEdge, QVector<CEdge*> & V);

	void					computeFace(CEdge * pEdge, unsigned ind);
        void					createFace(std::vector<CVertex*> & vVertices);

        QVector <CVertex*>	m_vVertices;
        QVector <CEdge*>	m_vEdges;
        QVector <CFace*>	m_vFaces;

        QVector<bool>		vEdgeInspected;

	CMesh *					m_MorphMesh;
};

#endif // CMETAMESH_H
